package com.example.homework3mybatis.service.impl;

import com.example.homework3mybatis.entity.Employee;
import com.example.homework3mybatis.mapper.EmployeeMapper;
import com.example.homework3mybatis.service.EmployeeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    EmployeeMapper employeeMapper;

    @Override
    public Employee findOneById(String id) {
        return employeeMapper.findOneById(id);
    }

    @Override
    public List<Employee> findAll() {
        return employeeMapper.findAll();
    }

    @Override
    public PageInfo<Employee> findByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo<>(employeeMapper.findByPage());
    }
}